<template>
  <div class="search">
    <f-form ref="form" :action="api.company" :form-key="this.formItem.companyId">
      <f-form-item label="企业名称" name="companyName" :required="true" :value="formItem.companyName"/>
      <f-form-item label="联系人" name="linkMan" :required="true" :value="formItem.linkMan"/>
      <f-form-item label="联系电话" name="linkTel" :required="true" :value="formItem.linkTel"/>
      <f-form-item label="企业地址" name="companyAddress" :required="true" :value="formItem.companyAddress"/>
      <f-form-item label="审核状态" name="auditState" type="radio" data-type="number" :data="api.company.authStatus" :value="formItem.auditState"/>
      <f-form-item label="企业简介" name="companyDesc" type="editor" :value="formItem"/>
      <f-form-item label="主营范围" name="businessScope" type="editor" :value="formItem"/>
      <f-form-item label="企业Logo" type="upload" name="companyLogo" v-if="loaded" :value.sync="formItem.companyLogo" :file-max="1"/>
    </f-form>
  </div>
</template>

<script>
  export default {
    name: 'companyForm',
    props: {},
    data () {
      return {
        isAdd: true,
        loaded: false,
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem () {
        return {}
      },
      setData (data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        this.isAdd = true
        if (data && data.companyId) {
          this.formItem = data
          this.isAdd = false
        }
        this.loaded = true
      },
      handleSubmit () {
        this.$refs.form.submit({ companyLogo: this.formItem.companyLogo, companyDesc: this.formItem.companyDesc, businessScope: this.formItem.businessScope })
      }
    },
    created () {

    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
